<template>
  <div class="dialog">
    <el-dialog
      :title="titleText"
      :visible.sync="showDialog"
      width="30%"
      top="0"
      :close-on-click-modal="false"
      @close="cancel"
    >
      <div class="meaasge-font">{{ message }}</div>
      <div slot="footer" class="dialog-footer">
        <el-button class="cancelbtn" @click="cancel()">取 消</el-button>
        <el-button type="primary" class="savebtn" @click="save()">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: '',
  components: {},
  props: {
    // 弹框名称
    titleText: {
      type: String,
      default: ""
    },
    message: {
      type: String,
      default: ""
    },
    show: {
      type: Boolean,
      default: false
    },
    editObject: {
      type: [Object],
      default: () => {
        return {}
      }
    }
  },
  data() {
    return {
      showDialog: this.show
    };
  },

  watch: {
    show(v) {
      this.showDialog = v;
    }
  },
  created() {
  },
  mounted() {
  },
  methods: {
    save() {
      this.$emit("save", this.editObject);
    },
    close() {
      this.$emit("closeDialog");
    },
    cancel() {
      this.$emit("cancelDialog");
    }
  }
};
</script>

<style lang="scss" scoped>
.meaasge-font{
  width: 100%;
  text-align: center;
  font-size: 20px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>
